From dcc87f7a6786065b919516b7c806e3f33c5c10a3 Mon Sep 17 00:00:00 2001 From: Kristian Rietveld Date: Fri, 4 Sep 2009 16:38:04 +0200 Subject: [PATCH] Move mark check to gtk_text_view_scroll_to_mark() Also use a different means to check that the given mark is in the text view's buffer. This will also play nice with anonymous and NULL marks. Suggested by Paolo Borelli. --- gtk/gtktextview.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/gtk/gtktextview.c b/gtk/gtktextview.c index 72d7fe3a1c..ad9cba06f4 100644 --- a/gtk/gtktextview.c +++ b/gtk/gtktextview.c @@ -1900,7 +1900,6 @@ gtk_text_view_queue_scroll (GtkTextView *text_view, gdouble xalign, gdouble yalign) { - const char *mark_name; GtkTextIter iter; GtkTextPendingScroll *scroll; @@ -1913,12 +1912,6 @@ gtk_text_view_queue_scroll (GtkTextView *text_view, scroll->xalign = xalign; scroll->yalign = yalign; - /* We need to verify that the buffer contains the mark, otherwise this - * can lead to data structure corruption later on. - */ - mark_name = gtk_text_mark_get_name (mark); - g_return_if_fail (gtk_text_buffer_get_mark (get_buffer (text_view), mark_name)); - gtk_text_buffer_get_iter_at_mark (get_buffer (text_view), &iter, mark); scroll->mark = gtk_text_buffer_create_mark (get_buffer (text_view), @@ -2167,6 +2160,11 @@ gtk_text_view_scroll_to_mark (GtkTextView *text_view, g_return_if_fail (xalign >= 0.0 && xalign <= 1.0); g_return_if_fail (yalign >= 0.0 && yalign <= 1.0); + /* We need to verify that the buffer contains the mark, otherwise this + * can lead to data structure corruption later on. + */ + g_return_if_fail (get_buffer (text_view) == gtk_text_mark_get_buffer (mark)); + gtk_text_view_queue_scroll (text_view, mark, within_margin, use_align, -- 2.30.2